<style>
.header{font:bold 20px arial;margin:0;} 
</style>
<table class="header" >
  <tr>
  <td width="280" >
<?=$user['name']?> 日程  
  </td>
  <td>
      <a href="?mon=<?=($monthnow-1)?>&year=<?=$yearnow?>"> 上一月 </a> - 
    <?=$yearnow?>年  <?=$monthnow?>月   - 
    <a href="?mon=<?=$monthnow+1?>&year=<?=$yearnow?>"> 下一月 </a>
  </td>
  </tr>
</table>
 
<table class="calender" style="clear:both;">
<tbody>
<tr class="me" >
  <th>日</th>
  <th>一</th>
  <th>二</th>
  <th>三</th>
  <th>四</th>
  <th>五</th>
  <th>六</th>
</tr>
<?
for($i=0;$i<$trnum;$i++) {
?>
<tr>
<?
   //每行七个单元格
   for($k=0;$k<7;$k++) {
   	  //取得单元格自身序号
   	  $tabidx=$i*7+$k;
      //若单元格序号小于当月第一天的星期数($wk1st)或大于(月总数+$wk1st),只填写空格，反之，写入日期
      if($tabidx<$wk1st or $tabidx>$mdays+$wk1st-1){
          echo '<td class="no" ></td>';
      }
      else{
        $dayecho =  $tabidx-$wk1st+1;
        $date = $yearnow.'-'.($monthnow < 10 ?'0'.$monthnow:$monthnow).'-'.($dayecho < 10 ?'0'.$dayecho:$dayecho);
      ?>
      <td width="140" <?=($date == $now)?'class="now"':''?> ><a href="/calender/edit/<?=$date?>/" ><span class="bk" ><?=$dayecho?></span>
      <span><?=nl2br($task[$date])?></span>
      </a></td>
      <?
      }
   }
   echo "</tr>
";
}
?>
</tbody></table>
